package com.dongdong.config;

import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class AlipayClientConfig {


    @Value("${aliPay.serverUrl}")
    private String serverUrl;

    @Value("${aliPay.appId}")
    private String appId;

    @Value("${aliPay.privateKey}")
    private String privateKey;

    @Value("${aliPay.format}")
    private String format;

    @Value("${aliPay.charset}")
    private String charset;

    @Value("${aliPay.alipayPublicKey}")
    private String alipayPublicKey;

    @Value("${aliPay.signType}")
    private String signType;



    @Bean
    public AlipayClient alipayClient(){

        AlipayClient alipayClient = new DefaultAlipayClient(
//                "https://openapi-sandbox.dl.alipaydev.com/gateway.do",
//                "9021000134692508",
//                "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCJL1CHX6xy2HS4Nbzfq+u0FoI5WfJwLP4evfCMPi0hiT36+JzDcYc9oFLvmllFWNCtx2RjWpLJUfvCobv9pDwXS0xQ37iBGDdIBWZ5NEnbLXEgd3jBB5B80sfKRY59HDTcUVi+nJojV0CQMcFct9dBI2GEYhlDpjqP9VkDdkr3N4nWgdGJtm3JpCCiLTw6xeZZ+zc5KR0OycO8UmfLWBMf1v0fLVW9PFZLzbX0QIime2BKhaaX/8Q0ktaNYq0zhfvpWFPpE8RJypWIjReZ94fYLCBWIUVTHOGcil7fAZCUmaRmsN8G9WcULA53V3brSu7QMOjBiQn2eDXQJUxdfcZPAgMBAAECggEAMVXrvxOgQBkqOMlSqJn6hWSG5rs7Xi5AIawrYzRFJMdnm+dm8T7V5UrQKM04h6D+Q1DvAHAlU/OA+CkUI4658aKpynf6saqUzvjqNnKgkQtRoNx2d+0RgGKJaWwEZ2gKdqVmpf5JzKXnWTQblw2igxGHU4W4EkUo0Hbq0TzsjuVH2nvPwiaqWOQizxo+Wk/b4APhY7Bpo9ZAVyXQbkfZwLDkmp4JDqvLvf1sjCRIBqHiE1GVfxydnrUdVVp/Rk1QBFLWm0KAWZQ5dyqS4HlreWG9WRGtNCP+YU0T/wIu/Ahfs18uqbrnD07UY3XBxF/Yc8Gp4yPFPY2A4rVLq/3YaQKBgQDktC219Cgx1StV4EACQQTUwajyZQV8XkJ0Wofbx9VWgHoqJ3cclHfOrvZnJAEOWRALhICd4EODOC0QPw/TdEoYfdEj5ijYRQUcZlkeEzKKgu3A/sPT/0qlWJ/mxPlrRmoMlD7S6DkVpa1jque+t1uPfONHAb4etdQIxFYMsXgOVQKBgQCZjtzPkDqPmFZipTJjlLHDNRHPnRVO8QbTJvDRPs1CPNFpIBxImNGf3oUk2TXzP6iP1l7JV8VTiMQ6Tdj5pmtciwdVvnR9bHZHpLIDggJC2aVP2sJQBDlwGCCXA2IXfKjKhDh61abbjAo2CCnX9gyU2G8k5VLZbMZ496BjGYveEwKBgAmVKx0mn9CGuAwfG0983fD0NFoDtZkicfJiILMqyluXgoblpG4EIoj8d8KWlZy+SpfQ83qp/OownmLB4a3gf4JLM0onyKpXKgGooC9Map+3ILMneZkWZ1BKSFjpA/JkvujMBV3c8RdhG8TDUnaBRErc1sEQ56BtyfacE2bwwLEJAoGADsyB408XFbesu50IGii+aP24VbXh09XOvpLGKqROy89oryT1FNoFec7MLhzw4hyEdjhGskjPL5nCr4vJGWY8epK7hjvwphXJ4GWy8juZVC/9ipCeoW+GyZLJsUQWNAVDjyDnAI+OoSIB6esnfTStSbsCGyAut92P0yCqSGKx5BkCgYA2cGl6wrYUNTEPynTKxEfqvtfHAXUX4299kIkozkCWQ4j2P2yFmy0CZ/gL5LSv2mkgZMfYZwLX9aTnJa2OJb2Ge1QHDphezTsPJzAEZgbSixVRFKcYZyuBDf16xg3RP/a6wdJma94zltX3QROssL/91VOH0f+bKMcp4z+TW/rqzA==",
//                "json",
//                "UTF-8",
//                "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAi4zPLYJ/hdYYErpd8XKqVu931D6RTfC5pWeATOiGRz1IG2WOoJ+pXCKsAFRynpIwnUoDYKMb8yyvbRHIKJnaRu/HIwaZ1LrjNs9BUBgMXcMpt9xNrZm8uryTJncdtL909TKyVAtvC+NzMclSGe4go52vV9gq46tnhZTStdM3QjtwbGyKbosvbVxZYKJNTEVx7dy88nl26OeCKv8BncWa2dkcT/zJWTy70DCcy4ZhZRbiNU9GNj1kjImwl1Ax7tVP1Egg+YWYtaSJGuvjnbgxqCSGC40LnqazGxVUY7tG6ULGQLTXeLx+Ku6qP6h5z0xqm64eXc153TX75fwqVraZxwIDAQAB",
//                "RSA2");
                serverUrl,
                appId,
                privateKey,
                format,
                charset,
                alipayPublicKey,
                signType);
        return alipayClient;
    }







}
